Skip to content

Add Async prefix to generated AWS client names#737

Merged
jonathan343 merged 2 commits into
developfrom
async-client-names
Jul 9, 2026
Merged

Add Async prefix to generated AWS client names#737
jonathan343 merged 2 commits into
developfrom
async-client-names

Conversation

@jonathan343

@jonathan343 jonathan343 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Generated AWS clients are async, but they're named <SdkId>Client (e.g. BedrockRuntimeClient). This PR renames them to Async<SdkId>Client (e.g. AsyncBedrockRuntimeClient) to match the convention and to free up the unprefixed name for the sync clients we plan to add later.

The rename is a breaking change for the clients already published under the old name. To keep existing code working, those clients also emit the old name as a deprecated alias that resolves to the async client and raises a DeprecationWarning. The alias is temporary and will be removed in a minor bump sometime in the future.

Scope

The Async rename applies to all generated AWS clients. The backwards-compat alias is only generated for the clients already published under the unprefixed name in awslabs/aws-sdk-python:

Bedrock Runtime, ConnectHealth, Lex Runtime V2, Polly, QBusiness, SageMaker Runtime HTTP2, Transcribe Streaming

New clients released after this change is merged are created with the Async-prefixed and no alias.

Before

Client Class:

class BedrockRuntimeClient
    ...

Usage (no warning):

>>> from aws_sdk_bedrock_runtime.client import BedrockRuntimeClient
>>> BedrockRuntimeClient()
<aws_sdk_bedrock_runtime.client.AsyncBedrockRuntimeClient object at 0x102ce64e0>

After

The old name stays importable at runtime (with a DeprecationWarning) and resolves for type checkers via the TYPE_CHECKING alias.

Client Class:

class AsyncBedrockRuntimeClient
    ...

if TYPE_CHECKING:
    # Deprecated alias for backwards compatibility, to be removed.
    BedrockRuntimeClient = AsyncBedrockRuntimeClient

def __getattr__(name: str) -> Any:
    if name == "BedrockRuntimeClient":
        warnings.warn(
            "BedrockRuntimeClient is deprecated, use AsyncBedrockRuntimeClient instead. "
            "This alias will be removed in a future version.",
            DeprecationWarning,
            stacklevel=2,
        )
        return AsyncBedrockRuntimeClient
    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

Usage:

>>> from aws_sdk_bedrock_runtime.client import AsyncBedrockRuntimeClient
>>> AsyncBedrockRuntimeClient()
<aws_sdk_bedrock_runtime.client.AsyncBedrockRuntimeClient object at 0x102ce7530>
>>> from aws_sdk_bedrock_runtime.client import BedrockRuntimeClient
<stdin>:1: DeprecationWarning: BedrockRuntimeClient is deprecated, use AsyncBedrockRuntimeClient instead. This alias will be removed in a future version.
>>> BedrockRuntimeClient()
<aws_sdk_bedrock_runtime.client.AsyncBedrockRuntimeClient object at 0x102ce64e0>

A newly added service (not in the allowlist) generates just the class, no alias:

class AsyncWeatherClient:
    ...

Backwards compatibility

Existing customer code using BedrockRuntimeClient will continue to work since we're aliasing it to AsyncBedrockRuntimeClient. This will be removed in a future version of the SDK in a minor bump before GA.

Testing

Regenerated all 7 aws-sdk-python clients. I verified all clients have the renamed class and only the existing clients get the aliasing logic.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Async clients are renamed from `<SdkId>Client` to `Async<SdkId>Client`
to match the Python convention. The old name remains as a deprecated
alias (via module `__getattr__` + `TYPE_CHECKING` binding) that warns
and returns the async client; it will be removed once sync clients land.

Also bump codegen to 0.4.0.
@jonathan343 jonathan343 requested a review from a team as a code owner July 9, 2026 04:07
SamRemis
SamRemis previously approved these changes Jul 9, 2026

@SamRemis SamRemis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; got this generated and running locally.

We could make an allow-list instead so we aren't shipping new clients with deprecated aliases, but as long as we swap this out soon, it's not a big concern.

@jonathan343

Copy link
Copy Markdown
Contributor Author

Yea, I though of the allow list but got lazy with the decision. Since you also had the same idea, I think it's worth doing. I'll add in the next revision.

@jonathan343 jonathan343 merged commit 99c983a into develop Jul 9, 2026
10 checks passed
@jonathan343 jonathan343 deleted the async-client-names branch July 9, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants